<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
    <style>

    </style>
</head>
<body>
    <div id="root">
        <button @click="huoqu">点击跳转</button>
        <div>你将在{{n}}s后跳转</div>
    </div>

    <script>
        const vm=new Vue({
            el:'#root',
            data:{
                n:5,
               

            },
            methods: {
                huoqu(){
                    const that=this;

                    setInterval(function(){
                
                        
                        if (that.n==0) {
                            location.href='https://www.bilibili.com/'
                            

                        }else{
                            that.n--;
                            
                        }
                    },1000)
                }
            },

        })
    </script>
</body>
</html>